#ifndef VEC2F_H
#define VEC2F_H





class vec2f {
 public:
  vec2f(const vec2f &);
  vec2f(float x = 0.0, float y = 0.0);
  vec2f(float f);

  float _x;
  float _y;
  const float * data();
  const float& getX () const;
  const float& getY () const;
  void setX(float f);
  void setY(float f);
  //void copy(const vec2f& v);
  vec2f operator+(const vec2f& a);
  vec2f operator*(const vec2f& a);
  vec2f operator-(const vec2f& a);
  vec2f operator/(const vec2f& a);
  const float operator[](const int a) const;


  vec2f& operator +=(vec2f const& v)
    {
      _data[0] += v.getX();
      _data[1] += v.getY();
      return *this;
    }
  
  vec2f& operator +=(float a)
    {
      _data[0] += a;
      _data[1] += a;
      return *this;
    }

  vec2f& operator -=(float a)
    {
      _data[0] -= a;
      _data[1] -= a;
      return *this;
    }
  
  vec2f& operator *=(float a)
    {
      _data[0] *= a;
      _data[1] *= a;
      return *this;
    }

  vec2f& operator /=(float a)
    {
      float inv = 1 / a;
      (*this) *= inv;
      return *this;
    }

  vec2f div(const float& diviseur, bool non_zero = true);
  private:
  float _data[3];

};



#endif
